const expressJoi = require('@escook/express-joi')
const express = require('express')
const router = express.Router()

// 引入文章类别的路由处理函数模块
const { getCates, addCate, deleteCateById, getCateById, updateCate } = require('../router_handler/cate')
// 引入wz\\文章类别的参数校验模块
const { addCateRuler, deleteCateByIdRuler, getCateByIdRuler, updateCateRuler } = require('../schema/cate')
// 获取文章分类列表
router.get('/article/cates', getCates)
// 新增文章分类
router.post('/article/addcates', expressJoi(addCateRuler), addCate)
// 根据 Id 删除文章分类
router.get('/article/deletecate/:id', expressJoi(deleteCateByIdRuler), deleteCateById)
// 根据 Id 获取文章分类数据
router.get('/article/cates/:id', expressJoi(getCateByIdRuler), getCateById)
// 根据 Id 更新文章分类数据
router.post('/article/updatecate', expressJoi(updateCateRuler), updateCate)
module.exports = router
